package fei.yuzhi.com.loveflowers.fragment.firstpagefragment.searchresult;

import android.util.Log;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fei.yuzhi.com.loveflowers.bean.searchbean.GoodsListBean;
import fei.yuzhi.com.loveflowers.bean.searchbean.SearchBean;
import fei.yuzhi.com.loveflowers.utils.FirstPageHttpUtils;

/**
 * Created by My on 2016/10/16.
 */
public class SearchResultModle implements SearchResultContract.SearchingModel {
    @Override
    public void GetSearchBean(final String keyword, final setOnGetBeanListener onGetBeanListener) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Log.i("tag","searchkey"+keyword);
                FirstPageHttpUtils.getSearchBean(keyword, new FirstPageHttpUtils.onSendSearchBean() {
                    @Override
                    public void sendSearchBean(SearchBean searchBean) {
                        List<GoodsListBean> goodsListBeanList=searchBean.getDatas().getGoods_list();
                        onGetBeanListener.getIntentData(goodsListBeanList);
                        Log.i("tag","结果数据下载成功");
                    }
                });
            }
        }).start();
    }

    public interface setOnGetBeanListener{
        void getIntentData(List<GoodsListBean> goodsListBeanList);
    }
}
